package cn.chi.user.controller;


import cn.chi.user.domain.dto.UserDTO;
import cn.chi.user.service.IUserService;
import cn.chi.util.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private IUserService userService;
    @PostMapping("/register")
    public AjaxResult register(@RequestBody UserDTO userDTO){
        try {
            userService.register(userDTO);
            return  AjaxResult.me();
        } catch (Exception e) {
            e.printStackTrace();
            return  AjaxResult.me().setMessage(e.getMessage());
        }
    }


}
